using System;
using System.Collections.Generic;
using System.Text;
using ECommerce.Library;
using ECommerce.Library.ECommerce;

namespace AutoGear.BLL
{
    public class Address : IAddress
    {
        private string _firstName;
        public string FirstName
        {
            get { return Security.BindStringOutput(_firstName, SecurityLevel.Three); }
            set { _firstName = Security.BindStringInput(value, SecurityLevel.Three); }
        }

        private string _lastName;
        public string LastName
        {
            get { return Security.BindStringOutput(_lastName, SecurityLevel.Three); }
            set { _lastName = Security.BindStringInput(value, SecurityLevel.Three); }
        }


        private string _addressLine1;
        public string AddressLine1
        {
            get { return Security.BindStringOutput(_addressLine1, SecurityLevel.Three); }
            set { _addressLine1 = Security.BindStringInput(Security.BindStringInput(value, SecurityLevel.One), SecurityLevel.Three); }
        }
        private string _addressLine2;
        public string AddressLine2
        {
            get { return Security.BindStringOutput(_addressLine2, SecurityLevel.Three); }
            set { _addressLine2 = Security.BindStringInput(Security.BindStringInput(value, SecurityLevel.One), SecurityLevel.Three); }
        }

        private string _city;
        public string City
        {
            get { return Security.BindStringOutput(_city, SecurityLevel.Three); }
            set { _city = Security.BindStringInput(Security.BindStringInput(value, SecurityLevel.One), SecurityLevel.Three); }
        }


        private string _addressState;
        public string AddressState
        {
            get { return Security.BindStringOutput(_addressState, SecurityLevel.Three); }
            set { _addressState = Security.BindStringInput(Security.BindStringInput(value, SecurityLevel.One), SecurityLevel.Three); }
        }

        private string _addressCountry;
        public string AddressCountry
        {
            get { return Security.BindStringOutput(_addressCountry, SecurityLevel.Three); }
            set { _addressCountry = Security.BindStringInput(Security.BindStringInput(value, SecurityLevel.One), SecurityLevel.Three); }
        }

        private string _zipCode;
        public string ZipCode
        {
            get { return Security.BindStringOutput(_zipCode, SecurityLevel.One); }
            set { _zipCode = Security.BindStringInput(value, SecurityLevel.One); }
        }
        private string _telephoneNumber=string.Empty;
        public string TelephoneNumber
        {
            get { return _telephoneNumber; }
            set
            {
                if (RegExUtil.IsPhoneNumber(value))
                    _telephoneNumber = value;
            }
        }
        private string _telephoneNumber2;
        public string TelephoneNumber2
        {
            get { return _telephoneNumber2; }
            set
            {
                _telephoneNumber2 = value;
            }
        }
        private string _emailAddress = string.Empty;
        public string EmailAddress
        {
            get { return _emailAddress; }
            set
            {
                if (RegExUtil.IsEmail(value))
                    _emailAddress = value;
            }
        }

        public Address()
        {

        }

        public Address(string firstName, string lastName, string addressLine1, string addressLine2,
                string city, string addressState, string addressCountry, string zipCode, string telephoneNumber, string telephoneNumber2, string emailAddress)
        {
            this.FirstName = firstName;
            this.LastName = lastName;
            this.AddressLine1 = addressLine1;
            this.AddressLine2 = addressLine2;
            this.City = city;
            this.AddressState = addressState;
            this.AddressCountry = addressCountry;
            this.ZipCode = zipCode;
            this.TelephoneNumber = telephoneNumber;
            this.TelephoneNumber2 = telephoneNumber2;
            this.EmailAddress = emailAddress;
        }

    }
}
